package ru.spbsu.electromenu.servlet;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.spbsu.electromenu.serialization.Deserializer;
import ru.spbsu.electromenu.serialization.Serializer;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;

/**
 * Date: 3/27/11
 * Time: 9:59 PM
 *
 * @author Artem Titov
 */
public class ClientHttpServlet extends SpringHttpServlet {
    private static final Logger logger = LoggerFactory.getLogger(ClientHttpServlet.class);

    protected Deserializer deserializer;
    protected Serializer serializer;

    @Override
    public void init(ServletConfig config) throws ServletException {
        super.init(config);
        deserializer = getBean("deserializer");
        serializer = getBean("serializer");
        if (serializer == null || deserializer == null) {
            logger.error("Failed to instantiate necessary beans");
            isValid = false;
            throw new IllegalStateException("Failed to instantiate necessary beans");
        }
    }

}
